<?php
/**
* Provides interface for making all administrative database changes
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @author David Poole <David.Poole@fccc.edu>
* @version 05-07-06
* @package Admin
*
* Copyright (C) 2003 - 2007 phpScheduleIt & 2010 ITOxygen
* License: GPL, see LICENSE
*/

include_once('lib/Template.class.php');
include_once('lib/Admin.class.php');
include_once('lib/User.class.php');
$t = new Template(translate('My Control Panel'));
$db = new DBEngine();

$t->printHTMLHeader();
$t->printWelcome();
$fn = isset($_POST['fn']) ? $_POST['fn'] : (isset($_GET['fn']) ? $_GET['fn'] : '');	// Set function

$user = new User(Auth::getCurrentID());

if (!validate_function($user, $fn)) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />'
        . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}


// Print HTML headers
echo "<?xml version=\"1.0\" encoding=\"$charset\"?" . ">\n";
$t->startMain();
?>

	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $languages[$lang][2]?>" lang="<?php echo $languages[$lang][2]?>">
	<head>
	<title>
	<?php echo translate('Reports')?>
	</title>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset?>" />
	<script language="JavaScript" type="text/javascript" src="functions.js"></script>
	<style type="text/css">
	@import url(css.css);
	</style>
	</head>
	<body>
   <h3 align="center">Reports</h3>

              

<?php
   echo '<p style="margin-top:10px;"><b>UPTN Statistical Reports</b></p>'
	  . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/daily.rptdesign" target="_blank">Daily Report</a>' . "</p>\n"
	  . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/weekly_bulletin.rptdesign" target="_blank">Weekly Report</a>' . "</p>\n"
	  . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/scheduling.rptdesign" target="_blank">Scheduling Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/meeting_type.rptdesign" target="_blank">Meeting Type Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/standing_meetings.rptdesign" target="_blank">Standing Meeting Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/event_category.rptdesign" target="_blank">Event Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/meeting_title_locations.rptdesign" target="_blank">Meeting Title w/Location Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/connection_location.rptdesign" target="_blank">Total Connections by Location Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/connection_category.rptdesign" target="_blank">Total Connections by Category Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/connection_category_location.rptdesign" target="_blank">Total Connections: UPTN, NONUPTN, Audio Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/billable_details.rptdesign" target="_blank">Billable Meeting Detail Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/sub_meeting.rptdesign" target="_blank">Submeeting Type Report</a>' . "</p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/pending.rptdesign" target="_blank">Meetings to Resolve</a>' . "</br></p>\n"  
	  . '<p><b>TeleMedicine Event Reports</b></p>'
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_site_specialty.rptdesign" target="_blank">TeleMedicine Event Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_insurance.rptdesign" target="_blank">TeleMedicine Insurance Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_practitioner.rptdesign" target="_blank">TeleMedicine Practitioner Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_events_specialty.rptdesign" target="_blank">TeleMedicine Specialty Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_events_specialty_prac.rptdesign" target="_blank">TeleMedicine Specialty by Practitioner Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_mileage.rptdesign" target="_blank">TeleMedicine Mileage Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_age.rptdesign" target="_blank">TeleMedicine Age Span Report</a>' . "</br></p>\n"
	  . '<p><b>TeleMedicine Connection Reports</b></p>' 
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_connection.rptdesign" target="_blank">TeleMedicine Connection Report</a>' . "</br></p>\n"
        . '<p><b>&raquo;</b> ' .  '<a href=":8080/birt/frameset?__report=report/tele_conn_site_specialty.rptdesign" target="_blank">TeleMedicine Connection By Site By Specialty Report</a>' . "</br></p>\n";
// Print HTML footer
$t->endMain();
?>
	<p align="center"><a href="http://phpscheduleit.sourceforge.net">phpScheduleIt v<?php echo $conf['app']['version']?></a></p>
	</body>
	</html>
<?php

/**
* Return if the user can access the update page
* @param User $user the user to evaluate
* @param string $function the requested function
* @return if the user can access the update page
*/
function validate_function(&$user, $function) {

$user = new User(Auth::getCurrentID());
$groups = $user->db->get_user_groups(Auth::getCurrentID());
$is_miduser = false;

foreach ($groups as $key => $value) {
  if ($groups[$key]['group_name'] === "Mid-User") {
    $is_miduser = true;
  }
}

	if (Auth::isAdmin() || $user->get_isadmin() || $is_miduser) {
		return true;
	}

	if ( $function == 'editPerms' || $function == 'resetPass' ) {
		return $user->is_group_admin();
	}

	return false;
}
?>
